<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-12 10:52:50
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-04-01 10:59:54
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\compliance-audit\\compliance-audit.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 搜索表单 -->
<!-- <page-header-wrapper [title]="''"> </page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
    <ng-container *ngIf="queryFieldCount > 4">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="search()" acl
          [acl-ability]="['ORDER-COMPLIANCE-AUDIT-search']">查询</button>
        <button nz-button nzType="primary" [disabled]="false" acl [acl-ability]="['ORDER-COMPLIANCE-AUDIT-export']"
          (click)="exprot()">导出</button>
        <button nz-button [disabled]="false" (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card> -->

<nz-card class="table-box">
  <div class="tab_header">
    <label class="page_title"> <label class="driver">|</label> 合规抽查</label>
    <nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
      <nz-tab [nzTitle]="'全部(' + tabs?.totalCount + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待抽查(' + tabs?.spotQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'合格(' + tabs?.qualifiedtity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'不合格(' + tabs?.unstayQuantity + ')'"></nz-tab>
    </nz-tabset>
  </div>
  <div>
    <st #st [bordered]="true" [scroll]="{ x: '2000px',y:scrollY }" [data]="service.$api_get_listCompliancePage"
      [columns]="columns"
      [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
      [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
      [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false">
      <ng-template st-row="freightPrice" let-item let-index="index">
        {{ item.freightPrice | currency }}
      </ng-template>
      <ng-template st-row="loadingTime" let-item let-index="index">
        <div *ngIf="item?.loadingTime">装 | {{ item?.loadingTime }}</div>
        <div *ngIf="item?.unloadingTime">卸 | {{ item?.unloadingTime }}</div>
      </ng-template>
      <ng-template st-row="driverName" let-item let-index="index">
        <div> {{ item?.driverName }}{{ item?.driverPhone ? "/" + item?.driverPhone : '' }}{{ item?.carNo ? "/" +
          item?.carNo : '' }} </div>
      </ng-template>
      <ng-template st-row="payeeName" let-item let-index="index">
        <div> {{ item?.payeeName }}{{ item?.payeePhone ? "/" + item?.payeePhone : '' }} </div>
      </ng-template>
      <ng-template st-row="billCode" let-item let-index="index">
        <a *ngIf="item.billType == '1'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{
          item.billCode }}</a>
        <a *ngIf="item.billType == '2'" [routerLink]="'/order-management/bulk/bulk-detail/' + item.id"
          [queryParams]="{ sts :1}">{{ item.billCode }}</a>
        <a *ngIf="item.billType == '3'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{
          item.billCode }}</a>
        <div>
          <span>{{ item?.billStatusLabel }}</span>
        </div>
        <div>
          <span>{{item?.billTypeLabel}}{{item?.serviceTypeLabel === item?.billTypeLabel ?
            '':item?.serviceTypeLabel}}</span>
        </div>
      </ng-template>
      <ng-template st-row="goodsName" let-item let-index="index">
        <div>{{ item?.goodsName }}</div>
        <div>
          <span>{{ item?.weight ? item?.weight + '吨/' : '' }}</span>
          <span>{{ item?.volume ? item?.volume + '方/' : '' }}</span>
          <span>{{ item?.goodsNumber ? item?.goodsNumber + '吨' : '' }}</span>
        </div>
      </ng-template>
      <ng-template st-row="mybidDetailInfo" let-item let-index="index">
        <div *ngIf="item.mybidDetailInfo.length > 0">
          <p *ngFor="let data of item.mybidDetailInfo">
            {{ data.expenseName }}：{{ data.price | currency }}
            <span *ngIf="data.paymentStatusLabel" style="color: #f59a63">{{ data.paymentStatusLabel }}</span>
          </p>
        </div>
      </ng-template>
    </st>
  </div>
</nz-card>

<ng-template #extraTemplate>
  <div>
    <button nz-button nzDanger [nzLoading]="service.http.loading" (click)="openDrawer()" acl
      [acl-ability]="['ORDER-COMPLIANCE-AUDIT-search']">筛选</button>
    <button nz-button nzDanger acl [acl-ability]="['ORDER-COMPLIANCE-AUDIT-export']" (click)="exprot()">导出</button>
    <button nz-button nzType="primary" (click)="audit()" acl
      [acl-ability]="['ORDER-COMPLIANCE-AUDIT-updateBillByComplianceBatch']"> 批量抽查 </button>
  </div>
</ng-template>

<nz-modal [(nzVisible)]="isVisibleRE" [nzWidth]="600" [nzFooter]="nzModalFooterview2" (nzOnOk)="handleOK()" nzTitle="抽查"
  (nzOnCancel)="handleCancel('1')">
  <ng-container *nzModalContent>
    <sf #sfView [schema]="schemaView" [ui]="uiView" [compact]="true" [button]="'none'"> </sf>
  </ng-container>
  <ng-template #nzModalFooterview2>
    <button nz-button nzType="default" (click)="reject()">不合格</button>
    <button nz-button nzType="primary" (click)="handleOK()">合格</button>
  </ng-template>
</nz-modal>

<nz-modal [(nzVisible)]="isVisible" [nzWidth]="600" [nzFooter]="nzModalFooter" nzTitle="运费变更记录"
  (nzOnCancel)="handleCancel('0')">
  <ng-container *nzModalContent>
    <st #stFloat multiSort size="small" [bordered]="true" [data]="service.$api_get_listChangeApply"
      [columns]="columnsFloat"
      [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: changeParams }"
      [res]="{ reName: { list: 'data', total: 'data.total' } }">
      <ng-template st-row="order" let-item let-index="index">
        {{ index + 1 }}
      </ng-template>
    </st>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="primary" (click)="handleCancel('0')">取消</button>
    <button nz-button nzType="default" (click)="handleCancel('0')">确定</button>
  </ng-template>
</nz-modal>

<nz-modal [(nzVisible)]="isVisibleView" [nzWidth]="600" [nzFooter]="nzModalFooterview" nzTitle="查看"
  (nzOnCancel)="handleCancel('2')">
  <ng-container *nzModalContent>
    <st #stFloatView size="small" [bordered]="true" [data]="service.$api_getChangeRecordWholeDetail"
      [columns]="columnsFloatView" [req]="{ method: 'POST', allInBody: true, params: changeViewParams }"
      [res]="{ reName: { list: 'data.list', total: 'data.total' } }">
      <ng-template st-row="amountBeforeChange" let-item let-index="index">
        {{ item.amountBeforeChange | currency }}
      </ng-template>
      <ng-template st-row="amountchangeValue" let-item let-index="index"> ￥{{ item.amountchangeValue | number: '0.2-2'
        }} </ng-template>
      <ng-template st-row="amountAfterChange" let-item let-index="index">
        {{ item.amountAfterChange | currency }}
      </ng-template>
    </st>
    <div><span>变更原因：{{ ViewCause?.changeCause }}</span></div>
    <div><span>拒绝原因：{{ ViewCause?.refuseCause }}</span></div>
    <div><span>注：附加费依据调整后的运输费用重新计算</span></div>
  </ng-container>
  <ng-template #nzModalFooterview>
    <button nz-button nzType="default" (click)="handleCancel('2')">取消</button>
    <button nz-button nzType="primary" (click)="handleCancel('2')">确定</button>
  </ng-template>
</nz-modal>